package com.itguigu.statices;

import com.itguigu.proxy.Calculator;

/**
 * 代理类 中介
 *
 */
public class CalculatorStaticProxy implements Calculator {
    //目标方法 房东
    private Calculator calculator;

    public CalculatorStaticProxy(Calculator calculator) {
        this.calculator = calculator;
    }

    @Override
    public int add(int i, int j) {
        System.out.println(i + "+" + j);
        int add = calculator.add(i, j);
        System.out.println("结果是：" + add);
        return add;
    }

    @Override
    public int sub(int i, int j) {
        System.out.println(i + "-" + j);
        int sub = calculator.sub(i, j);
        System.out.println("结果是：" + sub);
        return sub;
    }

    @Override
    public int mul(int i, int j) {
        return 0;
    }

    @Override
    public int div(int i, int j) {
        return 0;
    }
}
